import request from "@/utils/request.js";

// 用户登录
export function login(data) {
  return request({
    method: "post",
    url: "/api/login",
    data,
  });
}

// 获取用户信息
export function getUserInfo() {
  return request({
    method: "get",
    url: "/api/userInfo",
  });
}

// 获取用户列表
export function getUserList(params) {
  return request({
    method: "get",
    url: "/api/users",
    params,
  });
}

// 添加用户
export function addUser(data) {
  return request({
    method: "post",
    url: "/api/users",
    data,
  });
}

// 更新用户
export function updateUser(id, data) {
  return request({
    method: "put",
    url: `/api/users/${id}`,
    data,
  });
}

// 删除用户
export function deleteUser(id) {
  return request({
    method: "delete",
    url: `/api/users/${id}`,
  });
}
